package com.ruoyi.tjbb.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tjbb.domain.SysTjbbLcyxbb;
import com.ruoyi.tjbb.service.ISysTjbbLcyxbbService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 凌晨2-5点运行报表Controller
 * 
 * @author ruoyi
 * @date 2023-09-26
 */
@RestController
@RequestMapping("/tjbb/xsfx/lcyxbb")
public class SysTjbbLcyxbbController extends BaseController
{
    @Autowired
    private ISysTjbbLcyxbbService sysTjbbLcyxbbService;

    /**
     * 查询凌晨2-5点运行报表列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:lcyxbb:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysTjbbLcyxbb sysTjbbLcyxbb)
    {
        startPage();
        List<SysTjbbLcyxbb> list = sysTjbbLcyxbbService.selectSysTjbbLcyxbbList(sysTjbbLcyxbb);
        return getDataTable(list);
    }

    /**
     * 导出凌晨2-5点运行报表列表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:lcyxbb:export')")
    @Log(title = "凌晨2-5点运行报表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysTjbbLcyxbb sysTjbbLcyxbb)
    {
        List<SysTjbbLcyxbb> list = sysTjbbLcyxbbService.selectSysTjbbLcyxbbList(sysTjbbLcyxbb);
        ExcelUtil<SysTjbbLcyxbb> util = new ExcelUtil<SysTjbbLcyxbb>(SysTjbbLcyxbb.class);
        util.exportExcel(response, list, "凌晨2-5点运行报表数据");
    }

    /**
     * 获取凌晨2-5点运行报表详细信息
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:lcyxbb:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysTjbbLcyxbbService.selectSysTjbbLcyxbbById(id));
    }

    /**
     * 新增凌晨2-5点运行报表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:lcyxbb:add')")
    @Log(title = "凌晨2-5点运行报表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysTjbbLcyxbb sysTjbbLcyxbb)
    {
        return toAjax(sysTjbbLcyxbbService.insertSysTjbbLcyxbb(sysTjbbLcyxbb));
    }

    /**
     * 修改凌晨2-5点运行报表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:lcyxbb:edit')")
    @Log(title = "凌晨2-5点运行报表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysTjbbLcyxbb sysTjbbLcyxbb)
    {
        return toAjax(sysTjbbLcyxbbService.updateSysTjbbLcyxbb(sysTjbbLcyxbb));
    }

    /**
     * 删除凌晨2-5点运行报表
     */
    @PreAuthorize("@ss.hasPermi('tjbb/xsfx:lcyxbb:remove')")
    @Log(title = "凌晨2-5点运行报表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysTjbbLcyxbbService.deleteSysTjbbLcyxbbByIds(ids));
    }
}
